﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

namespace ProjectStorage.DocumentGenerator
{
    public class Common
    {
        public static string ObjectToXML(object obj)
        {
            System.Xml.Serialization.XmlSerializer ser = 
                new System.Xml.Serialization.XmlSerializer(obj.GetType());

            
            StringWriter writer = new StringWriter();
            ser.Serialize(writer, obj);

            return writer.ToString();
        }
        public static TextReader ObjectToReader(object obj)
        {
            return new StringReader(ObjectToXML(obj));
        }

        public static readonly string SPSFILENAME = "StorageProject.DocumentGenerator.Transformations.SPSFile.xslt";
    }
}
